<template>
    <div v-if="visible" class="modal-overlay" @click="closeModal">
      <div class="modal-content" @click.stop>
        <img :src="imageUrl" alt="公众号图片" class="modal-image" />
        <p class="modal-text">{{ message }}</p>
        <button @click="closeModal">关闭</button>
      </div>
    </div>
    </template>
     
    <script>
    import { ref } from 'vue';
     /* eslint-disable */
    export default {
    name: 'Modal',
    props: {
      imageUrl: String,
      message: String
    },
    setup(props) {
      const visible = ref(true);
     
      function closeModal() {
        visible.value = false;
      }
     
      return { visible, closeModal, ...props };
    }
    };
    </script>
    
   <style scoped>
   .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
   }
    
   .modal-content {
    background: white;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
   }
    
   .modal-image {
    max-width: 100%;
    height: auto;
   }
    
   .modal-text {
    margin: 20px 0;
   }
    
   button {
    padding: 10px 20px;
    cursor: pointer;
   }
   </style>